#ifndef MYDEBUGPRINT_H
#define MYDEBUGPRINT_H
#include <QDateTime>
#include <QDebug>
#include <QString>
#include <QObject>
#include <QThread>

//调试等级
//enum debugLevel
//{
//    INF, //普通/日常打印等级
//    DBG, //调试等级
//    ERR  //错误等级
//};

#define LOG(level, er) do{\
    QDateTime currentDateTime = QDateTime::currentDateTime();\
    Qt::HANDLE threadId = QThread::currentThreadId();\
    QString debugText = QObject::tr("时间[%1] %2 %3:").arg(currentDateTime.toString("yyyy-MM-dd HH:mm:ss")).arg(__FILE__).arg(__LINE__);\
    qDebug() << level << ": "<< debugText << "当前线程: " << threadId <<  endl << er;\
}while(0)

#define ILOG(er) LOG("常规测试", er);
#define DLOG(er) LOG(QObject::tr("调试检测"), er);
#define ELOG(er) LOG("错误警报", er);

#endif // MYDEBUGPRINT_H

/*
 * 用于查看背景色
 * QColor rgb = Scroll->palette().color(QPalette::Background);
 * qDebug() << tr("optionWidget背景色: ") << rgb.red() << " " << rgb.green() << " " << rgb.blue();
 */
